package controller

import (
	"github.com/gin-gonic/gin"
	"pingbuqingyun_django/app/controller/admin"
	"pingbuqingyun_django/app/controller/na"
)

// 此处定义的路由无需登陆验证
func InitNaRouter(router *gin.RouterGroup) {
	naRouter := router.Group("/")
	{
		naRouter.GET("captcha", na.CaptchaImgAPI)
		naRouter.POST("reg-user", na.RegisterAPI)
		naRouter.POST("pwd-login", na.PwdLoginHandler)
	}
}

// 此处的路由需要登陆后方可访问
func InitAdminRouter(router *gin.RouterGroup) {
	adminRouter := router.Group("/")
	{
		adminRouter.GET("users", admin.GetUserList)
		adminRouter.POST("user", admin.CreateUser)
		adminRouter.POST("user-stop", admin.DeactivateUser)
		adminRouter.POST("user-active", admin.ActivateUser)
		adminRouter.POST("user-change-permission", admin.ChangeUserPermission) // 改变用户的权限
		adminRouter.POST("pwd-reset", admin.ChangePwd)                         // 重置密码

		adminRouter.POST("member", admin.AddMemberController)
		adminRouter.POST("member-change", admin.UpdateMemberController)
		adminRouter.GET("member", admin.SearchMemberListController)
		adminRouter.POST("del-member", admin.DeleteMemberController)
		adminRouter.GET("member-count", admin.MemberCountController)
		adminRouter.POST("member-stop", admin.DeactivateMemberController)
		adminRouter.POST("member-active", admin.ActivateMemberController)
		adminRouter.POST("member-recharge", admin.RechargeMemberController)

	}
}
